<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/pubPromotion/pubPromotion.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
	            <dl>
					<dt>商品名称：</dt>
					<dd>
						<input name="search" id="search" type="text" class="txt" maxlength="16"/>
					</dd>
				</dl>
				<dl>
					<dt>是否推广：</dt>
					<dd>
					<select name="promotion">
						<option value="0">全部</option>
						<option value="1">已推广</option>
						<option value="2">未推广</option>
					</select>
					</dd>
				</dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.pubPromotion.mallQuery()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/pub/promotion/mallList',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'name',width:80,align:'center'">商品名称</th>
						<th data-options="field:'img',width:120,formatter:formatImg">商品图片</th>
						<th data-options="field:'resume',width:300,align:'center' ">商品介绍</th>
			            <th data-options="field:'id',align:'center',width:150,formatter:formatOperation">管理操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>

	<script>
		function formatOperation(value,row,index) {
			var l_html = '';
			l_html += '<a href="javascript:;" class="table_link" sourceBizzId='+row.id+' img='+row.img+' onclick="admin.pubPromotion.mallPromotion(this)">推广</a>';
			if(row.isPromotion){
				l_html += '<a href="javascript:;" class="table_link" sourceBizzId='+row.id+' img='+row.img+' onclick="admin.pubPromotion.showPromotion(this)">查看推广</a>';
			}
			return l_html;
		}
		function formatImg(img){
			var imgs=img.split(";");
	        return '<img style="width:120px;height:120px;" src="http://file.xfquanquan.com'+imgs[0]+'"/>'
	    }
	</script>
  </body>
</html>
